@include('layouts.homeheader')
		<script type="text/javascript" src="{{asset('public/homestyle/js/jquery-1.8.2.min.js')}}"></script>
		<script type="text/javascript" src="{{asset('public/homestyle/js/shunfeng.js')}}"></script>
		<script>
			window.onload = function () {
				var sel_inp = document.getElementsByClassName("w_sf_input");
				var sel_div = document.getElementsByClassName("select_citys");
				sel_inp[0].onclick = function(ev){
					var ev = ev||event;
					sel_div[0].style.display = "block";
					ev.stopPropagation();
					// alert()
				}
				sel_inp[1].onclick = function(ev){
					//没选取车地不能选择还车地
					var ev = ev||event;
					var text =sel_inp[0].value;
					if(text){
						sel_div[1].style.display = "block";
					}else{
						return false;
					}

					ev.stopPropagation();
				}
				//点击隐藏
				document.onclick = function(){
					sel_div[0].style.display = 'none';
					sel_div[1].style.display = 'none';
				}


			}
		</script>
		<div id="w_sf_top_div">

			<div class="w_sf_top" style=" background: url(http://zuche.com/public/homestyle/images/sf_banner.jpg) no-repeat 0 0;">
				<!--筛选区域-->
				<div class="w_sf_sx_div">
					<div class="w_sf_select">
						<h3>顺风车</h3>
						<div class="w_sf20"></div>
						<div class="w_sf_item">
							<span>取车地点</span>
							<input type="text" name="" id="" value="" class="w_sf_input startsf" ctid=""/>
							<div class="select_citys" >
								<h4 class="hot_c">热门城市</h4>
								<div>
									@foreach($Citys as $k => $v)
									<span ctid="{{$v['startctid']}}">{{$v["startcname"]}}</span>
									@endforeach
								</div>
							</div>
						</div>
						<div class="w_sf14"></div>
						<div class="w_sf_item">
							<span>还车城市</span>
							<input type="text" name="" id="" value="" class="w_sf_input endsf" ctid=""/>
							<div class="select_citys"  style = "display: none">
								<h4 class="hot_c">热门城市</h4>
								<div>
									@foreach($Citys as $k => $v)
										<span ctid="{{$v['endctid']}}">{{$v["endcname"]}}</span>
									@endforeach
								</div>
							</div>
						</div>
						<script>
							$(function(){
								$(".endsf").click(function(){
//									alert()
								var start = $(".select_citys span").eq(0).text();
								//alert(start);
								$.post("{{url('index/endCity')}}",{"start":start,"_token":"{{csrf_token()}}"},function(data){

								},"json");
								})
							})
						</script>

						<a href="javascript:;" class="w_sf_button" style="background: url(http://zuche.com/public/homestyle/images/bgbtnshover.png) no-repeat -85px -105px;">查 询</a>
					</div>
				</div>
				<!--筛选区域结束-->
			</div>
		</div>
		{{--筛选js--}}
		<script>
			$(function(){
				$(".w_sf_button").click(function(){
					var startCity = $(".w_sf_input").eq(0).attr('ctid');
//					alert(startCity);
					var endCity = $(".w_sf_input").eq(1).attr('ctid');
					$.post("{{url('index/sfajax')}}",{"startCity":startCity,"endCity":endCity,"_token":"{{csrf_token()}}"},function(data){
						if(data.status==0){//没有输入条件
							location.href=location.href;
						}else{//输入条件的情况
							var str="";
							$.each(data.msg,function(k,v){
								str += '<li><div class="w_sf_car_info">';
								str += '<img src=/'+v.info.smallimg+'/>'+v.info.carname+'</div>';
								str += '<div class="w_sf_data">从 '+v.ord.return_time+'<br>到'+v.ord.return_time+'<br>';
								str += '<span class="w_fontBlue">限租期：3天</span></div>';
								str += '<div class="w_sf_address">'+v.ord.return_cname+'→'+v.ord.borrow_cname+'</div>';
								str += '<div class="w_sf_price"><i>￥</i><span>'+v.info.cprice*0.3+'</span></div>';
								str += '<div class="w_sf_book"><a href="{{url('index/shunfeng/sfbook/info/').'/sf'.time().rand(100,999)}}" style="background: url(http://zuche.com/public/homestyle/images/bgbtnshover.png) no-repeat 0 -64px;">预  定</a></div></li>';
							})
							$(".w_sf_car_list ul").html(str)
						}
					},"json")
				})
			})
		</script>
		<!--内容区域-->
		<div id="w_sf_content">
			<!--左侧-->
			<div class="w_sf_con_left">
				<div class="w_sf_l_top">
					<p class="qubuc">全部</p>
					@foreach($Citys as $k=>$v)
						@if($k<5)
							<p><a href="javascript:;" class="city_sf_id" ctid="{{$v['startctid']}}">{{$v["startcname"]}}</a></p>
						@endif
					@endforeach
					<!--更多城市-->
					<div class="w_more_city">更多城市
						<div class="more_city_hid">
							@foreach($Citys as $k=>$v)
								<a href="javascript:;" class="city_sf_id" ctid="{{$v['startctid']}}">{{$v["startcname"]}}</a>
							@endforeach
						</div>
					</div>
				</div>
				<script>
					$(function(){
						$(".qubuc").click(function(){
							location.href = location.href;
						})
					})
				</script>
				<script>
					$(function(){
						$(".city_sf_id").click(function(){
							var startCity = $(this).attr("ctid");
							$.post("{{url('index/sfajax')}}",{"startCity":startCity,"endCity":"","_token":"{{csrf_token()}}"},function(data){
								if(data.status==0){//没有输入条件
									location.href=location.href;
								}else{//输入条件的情况
									var str="";
									"http://zuche.com/index/carinfo/6"
									$.each(data.msg,function(k,v){
										str += '<li><div class="w_sf_car_info">';
										str += '<a href="http://zuche.com/index/carinfo/'+v.info.id+'">'
										str += '<img src=/'+v.info.smallimg+'/></a>'+v.info.carname+'</div>';
										str += '<div class="w_sf_data">从 '+mydate(Date.parse(new Date())/1000)+'<br>到 '+mydate(v.ord.return_time+5*3600*24)+'<br>';
										str += '<span class="w_fontBlue">限租期：3天</span></div>';
										str += '<div class="w_sf_address">'+v.ord.return_cname+'→'+v.ord.borrow_cname+'</div>';
										str += '<div class="w_sf_price"><i>￥</i><span>'+v.info.cprice*0.3+'</span></div>';
										str += '<div class="w_sf_book"><a href="{{url('index/shunfeng/sfbook/info/').'/sf'.time().rand(100,999)}}" style="background: url(http://zuche.com/public/homestyle/images/bgbtnshover.png) no-repeat 0 -64px;">预  定</a></div></li>';
									})
									$(".w_sf_car_list ul").html(str)
								}
							},"json")
						})
					})
					function mydate(timestamp){
						var d = new Date(timestamp * 1000);
						var date = (d.getFullYear()) + "年" +
								(d.getMonth() + 1) + "月" +
								(d.getDate()) + "日"
						return date;
					}
				</script>
				<!--车型、取车区间、取车->还车-->
				<div class="w_sf_con_title">
					<p class="w_sf_car">车型</p>
					<p>取车区间</p>
					<p>取车->还车</p>
				</div>
				<div class="w_sf_sign">
					一口价：含车辆租赁费及门店服务费,基本保险费,手续费
				</div>
				<!--搜索的数据列表-->
				<div class="w_sf_car_list">
					<ul>
						@foreach($sfCars as $k=>$v)
							{{--@if(($v['ord']->return_time+5*3600*24)>time())--}}
							<li>
								<!--c车名、图片-->
								<div class="w_sf_car_info">
									<a href="{{url('index/carinfo/').'/'.$v['info']->id}}"><img src="{{'/'.$v["info"]->smallimg}}"/></a>

									{{$v["info"]->carname}}
									<input type="hidden" name="id" value="{{$v['info']->id}}">
								</div>
								<!--租车时间-->
								<div class="w_sf_data">
									从 {{date("Y年m月d日",time())}}
									<br>
									到 {{date("Y年m月d日",$v['ord']->return_time+5*3600*24)}}
									<br>
									<span class="w_fontBlue">限租期：2天</span>
								</div>
								<!--顺风路程-->
								<div class="w_sf_address">
									{{$v["ord"]->return_cname}}→{{$v["ord"]->borrow_cname}}
									<input type="hidden" name="sfstart" value="{{$v['ord']->return_ctid}}">
									<input type="hidden" name="sfend" value="{{$v['ord']->borrow_ctid}}">
								</div>
								<!--价格-->
								<div class="w_sf_price">
									<i>￥</i>
									<span>{{$v["info"]->cprice*0.3}}</span>
								</div>
								<!--预定按钮-->
								<div class="w_sf_book">
									<a href="{{url('index/shunfeng/sfbook/info/').'/sf'.time().rand(100,999)}}" style="background: url(http://zuche.com/public/homestyle/images/bgbtnshover.png) no-repeat 0 -64px;">预  定</a>
								</div>
							</li>
							{{--@endif--}}
						@endforeach
					</ul>
				</div>
				<script>
					$(function(){
						$(".w_sf_book a").click(function(){
							var id = $(this).parents("li").find('.w_sf_car_info input').val();//获得汽车id
							var sfstart = $(this).parents("li").find(".w_sf_address input[name='sfstart']").val();//获得顺风车起点
							var sfend = $(this).parents("li").find(".w_sf_address input[name='sfend']").val();//获得汽车终点id
							$.post("{{url('index/shunfeng/sfbook/sess')}}",{"id":id,"sfstart":sfstart,"sfend":sfend,"_token":"{{csrf_token()}}"},function(data){

							},"json")
						})
					})
				</script>
				<!--搜索的数据列表结束-->
			</div>
			<!--左侧结束-->
			<!--右侧-->
			<div class="w_sf_con_right">
				<img src="{{asset('public/homestyle/images/msgBind.jpg')}}"/>
				<div class="w_sf_gz">
					<h3>顺风车规则</h3>
					<div class="w_sf_gz_con">
						<ul>
							<li>1.	顺风车产品需在预订时预付全款，预付后不能退改；</li>
							<li>2.	顺风车产品，取还城市不能更改；</li>
							<li>3.	限租期内，优惠后总金额含车辆租赁费及门店服务费、基本保险费、手续费；</li>
							<li>4.	如需可选服务，另外计费；</li>
							<li>5.	超出限制里程，按1元/公里收取超里程服务费；</li>
							<li>6.	超出限制租期，需支付超时服务费：超时4小时以内，按小时收取超时服务费，每小时赠送20km里程；超时4小时以上，按正常价格按天收取车辆租赁费及门店服务费、基本保险及可选服务等费用，同时赠送不限里程；</li>
							<li>7.	取车或还车时间在21:00-次日8:00之间，每次需支付50元夜间服务费；</li>
							<li>8.	顺风车产品不与其他优惠活动同时享受。</li>
						</ul>
					</div>
				</div>
			</div>
			<!--右侧结束-->
		</div>
		<div id="w_sf_allcity">
			<p>城市快捷入口</p>
			<div class="w_city_dis">
				<ul>
					<li><a href="">北京租车</a></li>
					<li>北京租车</li>
					<li>北京租车</li>
					<li>北京租车</li>
					<li>北京租车</li>
					<li>北京租车</li>
					<li>北京租车</li>
					<li>北京租车</li>
					<li>北京租车</li>
					<li>北京租车</li>
					<li>北京租车</li>
					<li>北京租车</li>
					<li>北京租车</li>
					<li>北京租车</li>
					<li>北京租车</li>
					<li>北京租车</li>
				</ul>
			</div>
		</div>
@include('layouts.homefooter')
